var e = new (require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../utils/DPagination.js")).default)("records"), t = getApp();

Page({
    data: {
        records: {},
        recordCount: 0,
        orderIdStrings: []
    },
    onLoad: function(t) {
        this.setData({
            orderIdStrings: void 0 === t.order_ids ? "" : t.order_ids
        }), e.bind(this), e.clean(), this.getRecords();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        e.clean(), this.getRecords();
    },
    onReachBottom: function() {
        this.getRecords();
    },
    onShareAppMessage: function() {},
    getRecords: function() {
        var n = this;
        if (!e.loading && !e.finished) {
            e.loading = !0;
            var o = t.getNetAddresss("plugin.free-lottery.frontend.index.dividend");
            wx.showLoading(), t._getNetWork({
                url: o,
                data: {
                    order_ids: this.data.orderIdStrings,
                    page: e.loadPage
                },
                success: function(t) {
                    var o = t.data, r = o.data, a = o.result, i = o.msg;
                    wx.hideLoading(), 0 !== a ? (e.push(r.data), e.loading = !1, (r.data.length < r.per_page || r.last_page == r.current_page) && (e.finished = !0), 
                    wx.stopPullDownRefresh(), n.setData({
                        recordCount: 1
                    })) : wx.showToast({
                        title: i,
                        icon: "none"
                    });
                },
                fail: function(e) {
                    wx.hideLoading(), wx.showToast({
                        title: e.msg || e.message,
                        icon: "none"
                    });
                }
            });
        }
    },
    routerToDetails: function(e) {
        var t = e.currentTarget.dataset;
        wx.navigateTo({
            url: "/packageH/free_of_charge/FreeDetails/FreeDetails?order_id=" + t.orderId,
            success: function(e) {
                e.eventChannel.emit("recordDetails", {
                    data: t.order
                });
            }
        });
    }
});